﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class Vector3Util
{
    public static Vector2 ToVector2(this float angle)
    {
        return new Vector2(Mathf.Cos(angle * Mathf.Deg2Rad), Mathf.Sin(angle * Mathf.Deg2Rad));
    }

    public static float ToAngle(this Vector2 angle)
    {
        return Vector2.SignedAngle(Vector2.right, angle);
    }

    public static Vector3 ToVector3(this float angle)
    {
        return new Vector3(Mathf.Cos(angle * Mathf.Deg2Rad), Mathf.Sin(angle * Mathf.Deg2Rad), 0f);
    }

    public static float ToAngle(this Vector3 angle)
    {
        return Vector2.SignedAngle(Vector2.right, angle);
    }
}